package com.oa.hyperion.repository.assets;

import com.oa.hyperion.entity.assets.AssetsType;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;
/**
 * 资产类型
 * author yuanchongwei
 * date 2022-1-18
 */
public interface AssetsTypeMapper {
    /**
     * 添加资产分类
     * @param assetsType 类型
     */
    @Insert("insert into assets_type(type) values(#{type})")
    @Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
    public boolean insert(AssetsType assetsType);

    /**
     * 查询所有资产类型
     * @return
     */
    @Select("select * from assets_type")
    public List<AssetsType> getAssetsTypes();

    /**
     * 查询
     * 根据资产类型查询资产类型信息
     * @param id 资产类型
     * @return 资产类型信息
     */
    @Select("select * from assets_type where id=#{id}")
    public AssetsType getAssetsTypeById(int id);

    /**
     * 查询
     * 根据资产类型查询资产类型信息
     * @param type 资产类型
     * @return 资产类型信息
     */
    @Select("select * from assets_type where type=#{type}")
    public AssetsType getAssetsTypeByType(String type);


}
